import request from "@/utils/request";
import qs from "qs";

export function getTenants(paramters) {
  let url = "/api/multi-tenancy/tenants/";
  return request({
    url: url,
    method: "get",
    params: paramters,
  });
}

export function getTenant(id) {
  let url = "/api/multi-tenancy/tenants/" + id;
  return request({
    url: url,
    method: "get",
  });
}

export function addTenant(data) {
  let url = "/api/multi-tenancy/tenants/";
  return request({
    url: url,
    method: "post",
    data: data,
  });
}

export function updateTenant(data) {
  let url = "/api/multi-tenancy/tenants/" + data.id;
  return request({
    url: url,
    method: "put",
    data: data,
  });
}

export function deleteTenant(id) {
  let url = "/api/multi-tenancy/tenants/" + id;
  return request({
    url: url,
    method: "delete",
  });
}

export function getTenantConnection(id) {
  let url = "/api/multi-tenancy/tenants/" + id + "/connections";
  return request({
    url: url,
    method: "get",
  });
}

export function updateTenantConnection(id, data) {
  let url = "/api/multi-tenancy/tenants/" + id + "/connections";
  return request({
    url: url,
    method: "put",
    data: data,
  });
}
